<div ng-controller="audit_merchantController">
    <div class="pull-right input-group">
        <form>
            <input style="width: 170px;" type="text" ng-model="search" class="form-control" placeholder="Search by name/tel...">
            <span class="input-group-btn">
                <button class="btn btn-default" type="button">Search</button>
            </span>
        </form>
    </div>
    <div style="width: 95%;margin: auto;position: relative;">
        <table class="table table-striped" style="width: 100%">
            <thead>
            <tr>
                <th style="text-align: center">Logo</th>
                <th style="text-align: center">Name</th>
                <th style="text-align: center">Address</th>
                <th style="text-align: center">Tel</th>
                <th style="text-align: center">Application date</th>
                <th style="text-align: center">Status</th>
                <th></th>
                <th></th>
                <th></th>
            </tr>
            </thead>
            <tbody id='merchant-list'>
            <tr class="repeat-animation" ng-repeat="merchant in merchants | orderBy : ['status', 'createDate'] | filter : search" id="merchant-{{merchant._id}}">
                <td class="list-td merchant-list-detail"><img style="width:95px"
                                                              ng-src="http://zha-ita113-w7:8089/{{merchant.detail.logo}}">
                </td>
                <td class="list-td" width="13%">{{merchant.detail.mname }}</td>
                <td class="list-td" width="13%">{{merchant.detail.address}}</td>
                <td class="list-td" width="13%">{{merchant.detail.mtel}}</td>
                <td class="list-td" width="13%">{{merchant.createDate | date : 'yyyy-MM-dd hh:mm:ss'}}</td>
                <td id="status-{{merchant._id}}" class="list-td" width="13%">{{merchant.status | convertStatus}}</td>
                <td class="list-td" width="7%">
                    <button ng-click="updateStatus(merchant, 1)"
                            ng-disabled="{true : false, false: true}[merchant.status == 0 || merchant.status == 3]"
                            class="btn"
                            ng-class="{true : 'btn-primary', false: ''}[merchant.status == 0 || merchant.status == 3]">
                        Active
                    </button>
                </td>
                <td class="list-td" width="7%">
                    <button ng-click="updateStatus(merchant, 2)" class="btn"
                            ng-disabled="{true : false, false: true}[merchant.status == 0]" class="btn"
                            ng-class="{true : 'btn-warning', false: ''}[merchant.status == 0]">Refuse
                    </button>
                </td>
                <td class="list-td" width="7%">
                    <button ng-click="openWarning(merchant)"
                            ng-disabled="{true : false, false: true}[merchant.status == 1]" class="btn"
                            ng-class="{true : 'btn-danger', false: ''}[merchant.status == 1]"
                            class="btn">
                        Block
                    </button>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div ng-include="'/client/pages/merchantWarning_modal.html'"></div>

</div>
